#/usr/bin/env python
#-*- coding:utf8 -*-

import os

ls = os.linesep
fname = ""
while True:
    fname = raw_input("###input the file name: ")
    if os.path.exists(fname):
        print "!!!error, file name '%s' has existed"
    else:
        break

content = []
print "###Please input the content, one line each time(end with '.' by itself)"
while True:
    entry = raw_input(">")
    if entry=='.':
        print "###done"
        break
    else:
        content.append(entry)
f_obj = open(fname, "wb")
f_obj.writelines(["%s%s" % (ln,ls) for ln in content])
f_obj.close()
